gh-143935: Email preserve parens when folding comments (#143936)
authorSeth Michael Larson <seth@python.org>
Mon, 19 Jan 2026 12:38:22 +0000 (06:38 -0600)
committerAndrej Shadura <andrewsh@debian.org>
Sun, 25 Jan 2026 13:37:52 +0000 (14:37 +0100)
commitcf0be5c68ca9003a6eec9791ea581bc864f2a262
treefd6e761442c957faa10011b1bb6a2fd62803ac67
parent2f324a6976129fda41c4ddca40a47ad8b8f2a32b
gh-143935: Email preserve parens when folding comments (#143936)

Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.

Co-authored-by: Denis Ledoux <dle@odoo.com>
Origin: backport, https://github.com/python/cpython/commit/17d1490aa97bd6b98a42b1a9b324ead84e7fd8a2

Gbp-Pq: Name CVE-2025-11468.patch
Lib/email/_header_value_parser.py
Lib/test/test_email/test__header_value_parser.py
Misc/NEWS.d/next/Security/2026-01-16-14-40-31.gh-issue-143935.U2YtKl.rst [new file with mode: 0644]